<?php
declare(strict_types=1);
namespace Field;

class SysCurdConst
{
    public const pk='CurdID';
    public const index=['CurdID'];
	public const fields=['CurdID','Node','Title','Auth','Login','Menu','Component','Rank','Icon','Tpl','Conf','Columns','AddForm','Filter','Tools','Table1','Table2','Table3','Table4','Table5'];
	public const comment=['CurdID'=>'自增ID','Node'=>'节点','Title'=>'菜单名称','Auth'=>'是否授权','Login'=>'是否登录','Menu'=>'是否菜单','Component'=>'组件','Rank'=>'排序','Icon'=>'图标','Tpl'=>'页面模板','Conf'=>'页面配置','Columns'=>'列配置','AddForm'=>'新增配置','Filter'=>'筛选配置','Tools'=>'工具栏','Table1'=>'使用那些表','Table2'=>'','Table3'=>'','Table4'=>'','Table5'=>''];
	/*
    * @Field CurdID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment 自增ID
    */
    public const CurdID = 'CurdID';
    /*
    * @Field Node
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key MUL
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 节点
    */
    public const Node = 'Node';
    /*
    * @Field Title
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 菜单名称
    */
    public const Title = 'Title';
    /*
    * @Field Auth
    * @Type int(10)
    * @Collation 
    * @Null NO
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 是否授权
    */
    public const Auth = 'Auth';
    /*
    * @Field Login
    * @Type int(10)
    * @Collation 
    * @Null NO
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 是否登录
    */
    public const Login = 'Login';
    /*
    * @Field Menu
    * @Type int(10)
    * @Collation 
    * @Null NO
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 是否菜单
    */
    public const Menu = 'Menu';
    /*
    * @Field Component
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 组件
    */
    public const Component = 'Component';
    /*
    * @Field Rank
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 排序
    */
    public const Rank = 'Rank';
    /*
    * @Field Icon
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 图标
    */
    public const Icon = 'Icon';
    /*
    * @Field Tpl
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 页面模板
    */
    public const Tpl = 'Tpl';
    /*
    * @Field Conf
    * @Type text
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 页面配置
    */
    public const Conf = 'Conf';
    /*
    * @Field Columns
    * @Type text
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 列配置
    */
    public const Columns = 'Columns';
    /*
    * @Field AddForm
    * @Type text
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 新增配置
    */
    public const AddForm = 'AddForm';
    /*
    * @Field Filter
    * @Type text
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 筛选配置
    */
    public const Filter = 'Filter';
    /*
    * @Field Tools
    * @Type text
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 工具栏
    */
    public const Tools = 'Tools';
    /*
    * @Field Table1
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 使用那些表
    */
    public const Table1 = 'Table1';
    /*
    * @Field Table2
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Table2 = 'Table2';
    /*
    * @Field Table3
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Table3 = 'Table3';
    /*
    * @Field Table4
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Table4 = 'Table4';
    /*
    * @Field Table5
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Table5 = 'Table5';
}

class SysCurdColumns
{
public  int $CurdID;
   public  string $Node;
   public  string $Title;
   public  int $Auth;
   public  int $Login;
   public  int $Menu;
   public  string $Component;
   public  int $Rank;
   public  string $Icon;
   public  ?string $Tpl='';
   public  string $Conf;
   public  string $Columns;
   public  ?string $AddForm='';
   public  ?string $Filter='';
   public  ?string $Tools='';
   public  ?string $Table1='';
   public  ?string $Table2='';
   public  ?string $Table3='';
   public  ?string $Table4='';
   public  ?string $Table5='';
	public function toArray():array
	{
		return [
'CurdID'=>$this->CurdID,
    'Node'=>$this->Node,
    'Title'=>$this->Title,
    'Auth'=>$this->Auth,
    'Login'=>$this->Login,
    'Menu'=>$this->Menu,
    'Component'=>$this->Component,
    'Rank'=>$this->Rank,
    'Icon'=>$this->Icon,
    'Tpl'=>$this->Tpl,
    'Conf'=>$this->Conf,
    'Columns'=>$this->Columns,
    'AddForm'=>$this->AddForm,
    'Filter'=>$this->Filter,
    'Tools'=>$this->Tools,
    'Table1'=>$this->Table1,
    'Table2'=>$this->Table2,
    'Table3'=>$this->Table3,
    'Table4'=>$this->Table4,
    'Table5'=>$this->Table5,        ];
	}
}

class SysCurdRow
{
	public SysCurdColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'CurdID' => $this->data->CurdID,
        'Node' => $this->data->Node,
        'Title' => $this->data->Title,
        'Auth' => $this->data->Auth,
        'Login' => $this->data->Login,
        'Menu' => $this->data->Menu,
        'Component' => $this->data->Component,
        'Rank' => $this->data->Rank,
        'Icon' => $this->data->Icon,
        'Tpl' => $this->data->Tpl,
        'Conf' => $this->data->Conf,
        'Columns' => $this->data->Columns,
        'AddForm' => $this->data->AddForm,
        'Filter' => $this->data->Filter,
        'Tools' => $this->data->Tools,
        'Table1' => $this->data->Table1,
        'Table2' => $this->data->Table2,
        'Table3' => $this->data->Table3,
        'Table4' => $this->data->Table4,
        'Table5' => $this->data->Table5, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new SysCurdColumns();
        isset($data['CurdID']) && $this->data->CurdID = (int)$data['CurdID'];
           isset($data['Node']) && $this->data->Node = (string)$data['Node'];
           isset($data['Title']) && $this->data->Title = (string)$data['Title'];
           isset($data['Auth']) && $this->data->Auth = (int)$data['Auth'];
           isset($data['Login']) && $this->data->Login = (int)$data['Login'];
           isset($data['Menu']) && $this->data->Menu = (int)$data['Menu'];
           isset($data['Component']) && $this->data->Component = (string)$data['Component'];
           isset($data['Rank']) && $this->data->Rank = (int)$data['Rank'];
           isset($data['Icon']) && $this->data->Icon = (string)$data['Icon'];
           isset($data['Tpl']) && $this->data->Tpl = (string)$data['Tpl'];
           isset($data['Conf']) && $this->data->Conf = (string)$data['Conf'];
           isset($data['Columns']) && $this->data->Columns = (string)$data['Columns'];
           isset($data['AddForm']) && $this->data->AddForm = (string)$data['AddForm'];
           isset($data['Filter']) && $this->data->Filter = (string)$data['Filter'];
           isset($data['Tools']) && $this->data->Tools = (string)$data['Tools'];
           isset($data['Table1']) && $this->data->Table1 = (string)$data['Table1'];
           isset($data['Table2']) && $this->data->Table2 = (string)$data['Table2'];
           isset($data['Table3']) && $this->data->Table3 = (string)$data['Table3'];
           isset($data['Table4']) && $this->data->Table4 = (string)$data['Table4'];
           isset($data['Table5']) && $this->data->Table5 = (string)$data['Table5'];
    }
}
?>